<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<!--拆分信息-->
<div class="modal fade" id="modal-map">
    <div class="modal-dialog" style="width:1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">提报计划拆分记录查询</h4>
            </div>
            <div class="modal-body">
                <form id="mapForm">
                    <div class="row">
                        <div class="form-inline">
                            <div class="form-group">
                                <label>物料描述</label>
                                <input type="text" name="rppMatDesc" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>项目编号</label>
                                <input type="text" name="rppProjectCode" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>项目名称</label>
                                <input type="text" name="rppProjectName" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>计划员</label>
                                <input type="text" name="rppPlanner" class="form-control" placeholder="">
                            </div>
                            <div class="form-group col-sm-3"
                                 style="width: 290px;padding: 0px;margin: 0px; margin-right: 10px">
                                <label style="width: 60px;text-align: right">提报日期</label>
                                <input type="text" class="form-control datepicker" style="width: 102px;"
                                       name="startTime" readonly="readonly"/>
                                <span> 至 </span>
                                <input type="text" class="form-control datepicker" style="width: 102px" name="endTime"
                                       readonly="readonly"/>
                            </div>
                            <button type="button" class="btn btn-success" id="btn-map-search">
                                <span class="Bold">搜索</span>
                            </button>
                        </div>
                    </div>
                </form>
                <table id="map-table"></table>
            </div>
        </div>
    </div>
</div>
<!--添加-->
<div class="modal fade" id="modal-create">
    <div class="modal-dialog" style="width:800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">添加提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="createReportPlanForm" class="form-horizontal">
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">物料描述</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppMatDesc" autocomplete="off"
                                           placeholder="物料描述">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">项目编号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppProjectCode" autocomplete="off"
                                           placeholder="项目编号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">项目名称</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppProjectName" autocomplete="off"
                                           placeholder="项目名称">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">计划员</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppPlanner" title="">
                                        <option th:each="planner : ${planners}" th:value="${planner.empName}"
                                                th:text="${planner.empName}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">数量</label>
                                <div class="col-sm-8">
                                    <input type="number" step="0.1" class="form-control" name="rppNum"
                                           autocomplete="off" placeholder="数量">
                                </div>
                            </div>
                        </div>
                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-4 control-label">实用数量</label>-->
                        <!--                                <div class="col-sm-8">-->
                        <!--                                    <input type="number" step="0.1" class="form-control" name="rppRealNum"-->
                        <!--                                           autocomplete="off" placeholder="实用数量">-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-4 control-label">余量</label>-->
                        <!--                                <div class="col-sm-8">-->
                        <!--                                    <input type="number" step="0.1" class="form-control" name="rppOverNum"-->
                        <!--                                           autocomplete="off" placeholder="余量">-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">单位</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppUnit" autocomplete="off"
                                           placeholder="单位">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">型号/标准号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppStandardNo" autocomplete="off"
                                           placeholder="型号/标准号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">生产编号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppProduceCode" autocomplete="off"
                                           placeholder="生产编号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">品牌</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppBrand" autocomplete="off"
                                           placeholder="品牌">
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">分类</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppTypeId" title="">
                                        <option th:each="type : ${categories}" th:value="${type.dicId}"
                                                th:text="${type.dicName}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">计划号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppPlanNo" autocomplete="off"
                                           placeholder="计划号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">提报状态</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppUseStock" title="">
                                        <option value="1">使用库存</option>
                                        <option value="2">正常提报</option>
                                        <option value="3">暂不提报</option>
                                        <option value="0">无状态</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppRemark" autocomplete="off"
                                           placeholder="备注">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-create-report-plan">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--导入-->
<div class="modal fade" id="modal-import">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Excel信息导入</h4>
            </div>
            <div class="modal-body">
                <form id="importForm">
                    <div class="form-group">
                        <label>模版</label>
                        <a th:href="@{/file/提报计划模板.xlsx}">点击下载</a>
                    </div>
                    <div class="form-group">
                        <label>上次导入错误数据</label>
                        <a id="download-error"
                           th:data-url="@{/files/{user}/error.xls(user=${session.user.account})}"
                           href="javascript:void(0);">点击下载</a>
                    </div>
                    <!--<div class="form-group">
                        <label for="yearMonth">生产日报上传年月份</label>
                        <input type="text" class="form-control col-md-3" id="yearMonth" name="yearMonth"
                               th:value="${#dates.format(date, 'yyyy-MM')}" readonly="readonly"/>
                    </div>-->
                    <div class="form-group">
                        <label>选择Excel文件并上传</label>
                        <input class="btn" type="file" multiple="multiple" name="file">
                        <p class="help-block">请按模板格式进行导入，信息与模板信息对应。</p>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button shiro:hasPermission="buy:planexport:add" id="btn-upload" type="button" class="btn btn-success">
                    <span class="Bold">上传</span>
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--拆分导入-->
<div class="modal fade" id="modal-import-update">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Excel信息导入</h4>
            </div>
            <div class="modal-body">
                <form id="importFormUpdate">
                    <div class="form-group">
                        <label>上次导入错误数据</label>
                        <a  id="download-error-split"
                            th:data-url="@{/files/{user}/error1.xls(user=${session.user.account})}"
                            href="javascript:void(0);">点击下载</a>
                    </div>
                    <!--<div class="form-group">
                        <label for="yearMonth">生产日报上传年月份</label>
                        <input type="text" class="form-control col-md-3" id="yearMonth" name="yearMonth"
                               th:value="${#dates.format(date, 'yyyy-MM')}" readonly="readonly"/>
                    </div>-->
                    <div class="form-group">
                        <label>选择Excel文件并上传</label>
                        <input class="btn" type="file" multiple="multiple" name="file">
                        <p class="help-block">请按模板格式进行导入，信息与模板信息对应。</p>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button shiro:hasPermission="buy:planexport:add" id="btn-upload-update" type="button"
                        class="btn btn-success">
                    <span class="Bold">上传</span>
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--指定导入-->
<div class="modal fade" id="modal-import-update-assign">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Excel信息导入</h4>
            </div>
            <div class="modal-body">
                <form id="importFormUpdateAssign">
                    <div class="form-group">
                        <label>上次导入错误数据</label>
                        <a id="download-error-assign"
                           th:data-url="@{/files/{user}/error1.xls(user=${session.user.account})}"
                           href="javascript:void(0);">点击下载</a>
                    </div>
                    <!--<div class="form-group">
                        <label for="yearMonth">生产日报上传年月份</label>
                        <input type="text" class="form-control col-md-3" id="yearMonth" name="yearMonth"
                               th:value="${#dates.format(date, 'yyyy-MM')}" readonly="readonly"/>
                    </div>-->
                    <div class="form-group">
                        <label>选择Excel文件并上传</label>
                        <input class="btn" type="file" multiple="multiple" name="file">
                        <p class="help-block">请按模板格式进行导入，信息与模板信息对应。</p>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button shiro:hasPermission="buy:planexport:add" id="btn-upload-update-Assign" type="button"
                        class="btn btn-success">
                    <span class="Bold">上传</span>
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--修改计划员-->
<div class="modal fade" id="modal-edit-planner">
    <div class="modal-dialog" style="width:800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">修改提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="editPlannerForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="col-md-12">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">计划员</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppPlanner" title="">
                                        <option th:each="planner : ${planners}" th:value="${planner.empName}"
                                                th:text="${planner.empName}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-edit-planner">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--原始修改-->
<div class="modal fade" id="modal-edit">
    <div class="modal-dialog" style="width:800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">修改提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="editReportPlanForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">物料描述</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppMatDesc" autocomplete="off"
                                           placeholder="物料描述">
                                </div>
                            </div>
                        </div>
                        <!--<div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">计划员</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppPlanner" autocomplete="off" placeholder="计划员">
                                </div>
                            </div>
                        </div>-->
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">数量</label>
                                <div class="col-sm-8">
                                    <input type="number" step="0.1" class="form-control" name="rppNum"
                                           autocomplete="off" placeholder="数量">
                                </div>
                            </div>
                        </div>
                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-4 control-label">实用数量</label>-->
                        <!--                                <div class="col-sm-8">-->
                        <!--                                    <input type="number" step="0.1" class="form-control" name="rppRealNum"-->
                        <!--                                           autocomplete="off" placeholder="实用数量">-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-4 control-label">余量</label>-->
                        <!--                                <div class="col-sm-8">-->
                        <!--                                    <input type="number" step="0.1" class="form-control" name="rppOverNum"-->
                        <!--                                           autocomplete="off" placeholder="余量">-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">单位</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppUnit" autocomplete="off"
                                           placeholder="单位">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">型号/标准号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppStandardNo" autocomplete="off"
                                           placeholder="型号/标准号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">生产编号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppProduceCode" autocomplete="off"
                                           placeholder="生产编号">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">品牌</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppBrand" autocomplete="off"
                                           placeholder="品牌">
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">分类</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppTypeId" title="">
                                        <option th:each="type : ${categories}" th:value="${type.dicId}"
                                                th:text="${type.dicName}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">计划号</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="rppPlanNo" autocomplete="off"
                                           placeholder="计划号">
                                </div>
                            </div>
                        </div>
                        <!--<div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">项目名称</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppProjectName" autocomplete="off" placeholder="项目名称">
                                </div>
                            </div>
                        </div>-->
                        <div class="col-md-6" id="rppUseStockByModal">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">提报状态</label>
                                <div class="col-sm-8">
                                    <select class="form-control" name="rppUseStock" title="">
                                        <option value="">无状态</option>
                                        <option value="1">使用库存</option>
                                        <option value="2">正常提报</option>
                                        <option value="3">暂不提报</option>
                                        <option value="4">甲供</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppRemark" autocomplete="off"
                                           placeholder="备注">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">计划员备注</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppPlannerRemark" autocomplete="off"
                                           placeholder="计划员备注">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注SAP物料编码</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppRemarkSapCode" autocomplete="off"
                                           placeholder="备注SAP物料编码">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注SAP物料描述</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="rppRemarkMatDesc" autocomplete="off"
                                           placeholder="备注SAP物料描述">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-warning assign-plan" onclick="assignPlan()">指定采购计划</button>
                <button type="button" class="btn btn-info" id="btn-edit-report-plan">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--拆分后修改-->
<div class="modal fade" id="modal-edit-split">
    <div class="modal-dialog" style="width:800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">修改提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="editSplitReportPlanForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="col-md-12">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 text-right">项目名称</label>
                                <div class="col-sm-9">
                                    <span id="rppProjectName"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">原提报计划数量</label>
                                <div class="col-sm-6">
                                    <span id="srcNum"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">已拆分计划数量</label>
                                <div class="col-sm-6">
                                    <span id="alreadySplitNum"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">计划员</label>
                                <div class="col-sm-6">
                                    <span id="rppPlanner"></span>
                                </div>
                            </div>
                        </div>

                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-6 text-right">实用数量</label>-->
                        <!--                                <div class="col-sm-6">-->
                        <!--                                    <span id="rppRealNum"></span>-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <!--                        <div class="col-md-6">-->
                        <!--                            <div class="form-group">-->
                        <!--                                <label class="col-sm-6 text-right">余量</label>-->
                        <!--                                <div class="col-sm-6">-->
                        <!--                                    <span id="rppOverNum"></span>-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">单位</label>
                                <div class="col-sm-6">
                                    <span id="rppUnit"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">型号/标准号</label>
                                <div class="col-sm-6">
                                    <span id="rppStandardNo"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">品牌</label>
                                <div class="col-sm-6">
                                    <span id="rppBrand"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">项目编号</label>
                                <div class="col-sm-6">
                                    <span id="rppProjectCode"></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">分类</label>
                                <div class="col-sm-6">
                                    <span id="rppTypes"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 text-right">计划号</label>
                                <div class="col-sm-6">
                                    <span id="rppPlanNo"></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 control-label">数量</label>
                                <div class="col-sm-6">
                                    <input type="number" step="0.1" class="form-control" name="rppNum"
                                           autocomplete="off" placeholder="数量">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-6 control-label">提报状态</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="rppUseStock" title="">
                                        <option value="1">使用库存</option>
                                        <option value="2">正常提报</option>
                                        <option value="3">暂不提报</option>
                                        <option value="4">甲供</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="rppRemark" autocomplete="off"
                                           placeholder="备注">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注SAP物料编码</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="rppRemarkSapCode" autocomplete="off"
                                           placeholder="备注SAP物料编码">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注SAP物料描述</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="rppRemarkMatDesc" autocomplete="off"
                                           placeholder="备注SAP物料描述">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary assign-plan" onclick="assignPlanSplit()">指定</button>
                <button type="button" class="btn btn-info" id="btn-edit-split-report-plan">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--拆分-->
<div class="modal fade" id="modal-split">
    <div class="modal-dialog" style="width:1200px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">拆分提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="splitForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划员</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanner"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">物料描述</label>
                                <div class="col-sm-8">
                                    <span id="rppMatDesc"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">数量</label>
                                <div class="col-sm-8">
                                    <span id="rppNum"></span>
                                </div>
                            </div>
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">实用数量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppRealNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">余量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppOverNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="form-group">
                                <label class="col-sm-4 text-right">单位</label>
                                <div class="col-sm-8">
                                    <span id="rppUnit"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rppStandardNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">品牌</label>
                                <div class="col-sm-8">
                                    <span id="rppBrand"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目编号</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectCode"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-4 text-right">分类</label>
                                <div class="col-sm-8">
                                    <span id="rppTypes"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划号</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目名称</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">备注</label>
                                <div class="col-sm-8">
                                    <span id="rppRemark"></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-8">
                            <div class="row">
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="text" class="form-control" name="desc" autocomplete="off"
                                                   placeholder="物料描述">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="number" step="0.1" class="form-control" name="num"
                                                   placeholder="拆分数量">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <select class="form-control" name="status" title="">
                                                <option value="2" selected>正常提报</option>
                                                <option value="1">使用库存</option>
                                                <option value="3">暂不提报</option>
                                                <option value="0">无状态</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="text" class="form-control" name="remark" autocomplete="off"
                                                   placeholder="备注">
                                        </div>
                                    </div>
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="text" class="form-control" name="desc" autocomplete="off"
                                                   placeholder="物料描述">
                                        </div>

                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="number" step="0.1" class="form-control" name="num"
                                                   placeholder="拆分数量">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <select class="form-control" name="status" title="">
                                                <option value="2" selected>正常提报</option>
                                                <option value="1">使用库存</option>
<!--                                                <option value="3">暂不提报</option>-->
                                                <option value="0">无状态</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <div class="col-md-12">
                                            <input type="text" class="form-control" name="remark" autocomplete="off"
                                                   placeholder="备注">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="div-append"></div>
                            <button type="button" class="btn btn-info pull-right" style="margin-right: 20px"
                                    id="btn-append">添加
                            </button>
                            <p class="text-danger">物料描述和拆分数量必须填写，未填写的记录系统将不进行处理</p>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-split">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--变更-->
<div class="modal fade" id="modal-change">
    <div class="modal-dialog" style="width:1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">变更提报计划</h4>
            </div>
            <div class="modal-body">
                <form id="changeReportPlanForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划员</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanner"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">数量</label>
                                <div class="col-sm-8">
                                    <span id="rppNum"></span>
                                </div>
                            </div>
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">实用数量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppRealNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">余量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppOverNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="form-group">
                                <label class="col-sm-4 text-right">单位</label>
                                <div class="col-sm-8">
                                    <span id="rppUnit"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rppStandardNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">品牌</label>
                                <div class="col-sm-8">
                                    <span id="rppBrand"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目编号</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectCode"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-4 text-right">分类</label>
                                <div class="col-sm-8">
                                    <span id="rppTypes"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划号</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目名称</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">备注</label>
                                <div class="col-sm-8">
                                    <span id="rppRemark"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">物料描述</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="rppMatDesc" autocomplete="off"
                                               placeholder="物料描述">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">计划员</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="rppPlanner" autocomplete="off"
                                               placeholder="计划员">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">数量</label>
                                    <div class="col-sm-8">
                                        <input type="number" step="0.1" class="form-control" name="rppNum"
                                               autocomplete="off" placeholder="数量">
                                    </div>
                                </div>
                            </div>
                            <!--                            <div class="col-md-6">-->
                            <!--                                <div class="form-group">-->
                            <!--                                    <label class="col-sm-4 control-label">实用数量</label>-->
                            <!--                                    <div class="col-sm-8">-->
                            <!--                                        <input type="number" step="0.1" class="form-control" name="rppRealNum"-->
                            <!--                                               autocomplete="off" placeholder="实用数量">-->
                            <!--                                    </div>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <!--                            <div class="col-md-6">-->
                            <!--                                <div class="form-group">-->
                            <!--                                    <label class="col-sm-4 control-label">余量</label>-->
                            <!--                                    <div class="col-sm-8">-->
                            <!--                                        <input type="number" step="0.1" class="form-control" name="rppOverNum"-->
                            <!--                                               autocomplete="off" placeholder="余量">-->
                            <!--                                    </div>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">单位</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="rppUnit" autocomplete="off"
                                               placeholder="单位">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">型号/标准号</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="rppStandardNo" autocomplete="off"
                                               placeholder="型号/标准号">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">品牌</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="rppBrand" autocomplete="off"
                                               placeholder="品牌">
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">分类</label>
                                    <div class="col-sm-8">
                                        <select class="form-control" name="rppTypeId" title="">
                                            <option th:each="type : ${categories}" th:value="${type.dicId}"
                                                    th:text="${type.dicName}"></option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">计划号</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="rppPlanNo" autocomplete="off"
                                               placeholder="计划号">
                                    </div>
                                </div>
                            </div>
                            <!--<div class="col-md-12">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目名称</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="rppProjectName" autocomplete="off" placeholder="项目名称">
                                    </div>
                                </div>
                            </div>-->
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">备注</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="rppRemark" autocomplete="off"
                                               placeholder="备注">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">变更原因</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="rppChange" autocomplete="off"
                                               placeholder="原因">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-change-report-plan">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--指定-->
<div class="modal fade" id="modal-mark">
    <div class="modal-dialog" style="width:1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">指定库存</h4>
            </div>
            <div class="modal-body">
                <form id="markForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <input type="hidden" name="code">
                    <input type="hidden" name="name">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划员</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanner"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">提报物料描述</label>
                                <div class="col-sm-8">
                                    <span id="rppMatDesc"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">数量</label>
                                <div class="col-sm-8">
                                    <span id="rppNum"></span>
                                </div>
                            </div>
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">实用数量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppRealNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">余量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppOverNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="form-group">
                                <label class="col-sm-4 text-right">单位</label>
                                <div class="col-sm-8">
                                    <span id="rppUnit"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rppStandardNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">品牌</label>
                                <div class="col-sm-8">
                                    <span id="rppBrand"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目编号</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectCode"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-4 text-right">分类</label>
                                <div class="col-sm-8">
                                    <span id="rppTypes"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划号</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目名称</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">部分</label>
                                <div class="col-sm-8">
                                    <span id="rppPart"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">备注</label>
                                <div class="col-sm-8">
                                    <span id="rppRemark"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-4 text-right">指定物料</label>
                                <div class="col-sm-6">
                                    <input type="text" name="rppAssignDesc" class="form-control" placeholder="">
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-success" id="btn-assign">
                                        <span class="Bold">指定</span>
                                    </button>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-4 text-right">单价</label>
                                <div class="col-sm-6">
                                    <input type="text" oninput="formatNumber(this)" name="rppAssignUseStockPrice"
                                           class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-4 text-right">数量</label>
                                <div class="col-sm-6">
                                    <input type="text" oninput="formatNumber(this)" name="rppDiyAssignUseStockNum"
                                           class="form-control" placeholder="请输入数量" maxlength="25">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-4 text-right">单位</label>
                                <div class="col-sm-6">
                                    <input type="text" name="rppDiyAssignUseStockUnit" class="form-control"
                                           placeholder="请输入单位" maxlength="255">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="row">
                                <div class="form-inline">
                                    <div class="form-group">
                                        <label>物料描述</label>
                                        <input type="text" name="info" class="form-control" placeholder="">
                                    </div>
                                    <div class="form-group">
                                        <label>型号/标准号</label>
                                        <input type="text" name="standardNo" class="form-control" placeholder="">
                                    </div>
                                    <button type="button" class="btn btn-success" id="btn-mark-search">
                                        <span class="Bold">搜索</span>
                                    </button>
                                </div>
                            </div>
                            <table id="mark-table"></table>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="btn-mark">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--查看指定信息-->
<div class="modal fade" id="modal-info">
    <div class="modal-dialog" style="width:1200px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">查看指定</h4>
            </div>
            <div class="modal-body">
                <table id="report-plan-table"></table>
                <table id="mark-info-table"></table>
            </div>
        </div>
    </div>
</div>
<!--批量修改状态-->
<div class="modal fade" id="modal-batch">
    <div class="modal-dialog" style="width:1400px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">修改提报状态</h4>
            </div>
            <div class="modal-body">
                <form id="batchForm">
                    <input type="hidden" name="rppPlanner">
                    <input type="hidden" name="rppStatus" value="2">
                    <input type="hidden" name="rppIsFlag" value="0">
                    <div class="row">
                        <div class="form-inline">
                            <div class="form-group">
                                <label>物料描述</label>
                                <input type="text" name="rppMatDesc" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>项目编号</label>
                                <!--<input type="text" name="rppProjectCode" class="form-control" placeholder="请输入项目编号">-->
                                <input type="hidden" style="display: none" name="rppProjectCodeArrayStr"/>
                                <div class="form-control" name="rppProjectCodeArraySelect"
                                     style="OVERFLOW-Y: auto; OVERFLOW-X:hidden;width: 196px!important; display: inline-block; height:34px!important;-webkit-border-radius: 0 !important;-moz-border-radius: 0 !important;border-radius: 0 !important;">
                                </div>
                                <label class="control-label" style="line-height: 34px;">
                                    <button type="button"
                                            class="btn-success btn-xs"
                                            style="
                                                font-weight: 900;
                                                border-radius: 5px"
                                            name="addRppProjectCodeArraySelect">
                                        <i class="glyphicon glyphicon-plus"></i>
                                    </button>
                                    <button type="button"
                                            class="btn-danger btn-xs"
                                            style="

                                                font-weight: 900;
                                                border-radius: 5px"
                                            name="subtractRppProjectCodeArraySelect">
                                        <i class="glyphicon glyphicon-minus"></i></button>
                                </label>
                                <!--<input type="text" name="rppProjectCode" class="form-control" placeholder="">-->
                            </div>
                            <div class="form-group">
                                <label>项目名称</label>
                                <input type="text" name="rppProjectName" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>计划号</label>
                                <input type="text" name="rppPlanNo" class="form-control" placeholder="">
                            </div>
                            <!--<div class="form-group">
                                <label>计划员</label>
                                <input type="text" name="rppPlanner" class="form-control" placeholder="">
                            </div>-->
                            <div class="form-group">
                                <label>型号/标准号</label>
                                <input type="text" name="rppStandardNo" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>生产状态</label>
                               <select name="rppProjectState" class="form-control"
                                        style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width:auto!important;">
                                    <option value="" selected="selected">全部</option>
                                    <option value="-1">无状态</option>
                                    <option value="1">未开始</option>
                                    <option value="2">执行中</option>
                                    <option value="3">已完成</option>
                                    <option value="4">取消</option>
                                    <option value="5">暂缓</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>提报状态</label>
                                <select class="form-control selectpicker" data-actions-box="true" multiple
                                        id="rppUseStock2" title="">
                                    <option value="2" selected>正常提报</option>
                                    <option value="1" selected>使用库存</option>
                                    <option value="3" selected>暂不提报</option>
                                    <option value="0" selected>无状态</option>
                                </select>
                                <input th:if="${queryModel}==null" type="hidden" name="rppUseStockStr" value="0,1,2,3"
                                       style="display: none">
                            </div>
                            <!--<div class="form-group" >
                                <label>指定状态</label>
                                <select name="rppIsFlag" class="form-control">
                                    <option value="" selected="selected">全部</option>
                                    <option value="1">已指定</option>
                                    <option value="0">未指定</option>
                                </select>
                            </div>-->
                            <div class="form-group">
                                <label>提报日期</label>
                                <input type="text" class="form-control datepicker" name="startTime"
                                       readonly="readonly"/>
                                <span> 至 </span>
                                <input type="text" class="form-control datepicker" name="endTime" readonly="readonly"/>
                            </div>
                            <div class="form-group">
                                <label>修改提报状态日期</label>
                                <input type="text" class="form-control datepicker" name="startTimeByEdit"
                                       readonly="readonly"/>
                                <span> 至 </span>
                                <input type="text" class="form-control datepicker" name="endTimeByEdit"
                                       readonly="readonly"/>
                            </div>
                            <button type="button" class="btn btn-success" id="btn-batch-search">
                                <span class="Bold">搜索</span>
                            </button>
                        </div>
                    </div>
                </form>
                <div class="row" id="batchBar">
                    <div class="form-inline">

                        <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                           class="btn btn-info pull-right" style="margin-right: 10px" onclick="batchUpdate(0)">
                            <span class="Bold">清空状态</span>
                        </a>
                        <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                           class="btn pull-right" style="margin-right: 10px;background: #5cb85c;color:#FFFFFF;" onclick="batchUpdate(4)">
                            <span class="Bold">甲供</span>
                        </a>
                        <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                           class="btn btn-danger pull-right" style="margin-right: 10px" onclick="batchUpdate(3)">
                            <span class="Bold">暂不提报</span>
                        </a>
                        <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                           class="btn btn-warning pull-right" style="margin-right: 10px" onclick="batchUpdate(1)">
                            <span class="Bold">使用库存</span>
                        </a>
                        <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                           class="btn btn-success pull-right" style="margin-right: 10px" onclick="batchUpdate(2)">
                            <span class="Bold">正常提报</span>
                        </a>
                    </div>
                </div>
                <table id="batch-table" data-height="650"></table>
            </div>
        </div>
    </div>
</div>
<!--外购件批量指定-->
<div class="modal fade" id="modal-out-assign">
    <div class="modal-dialog" style="width:1400px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">批量库存指定</h4>
            </div>
            <div class="modal-body">
                <!--<form id="outAssignForm">
                    <input type="hidden" name="rppPlanner" >
                    <input type="hidden" name="rppStatus" value="2">
                    <input type="hidden" name="rppIsFlag" value="0">
                    <div class="row">
                        <div class="form-inline">
                            <div class="form-group">
                                <label>物料描述</label>
                                <input type="text" name="rppMatDesc" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>项目编号</label>
                                <input type="text" name="rppProjectCode" class="form-control" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>项目名称</label>
                                <input type="text" name="rppProjectName" class="form-control" placeholder="">
                            </div>
                            &lt;!&ndash;<div class="form-group">
                                <label>计划员</label>
                                <input type="text" name="rppPlanner" class="form-control" placeholder="">
                            </div>&ndash;&gt;
                            <div class="form-group">
                                <label>生产状态</label>
                                 <option value="" selected="selected">全部</option>
                                    <option value="-1">无状态</option>
                                    <option value="1">未开始</option>
                                    <option value="2">执行中</option>
                                    <option value="3">已完成</option>
                                    <option value="4">取消</option>
                                    <option value="5">暂缓</option>
                            </div>
                            <div class="form-group">
                                <label>提报状态</label>
                                <select class="form-control" name="rppUseStock" title="">
                                    <option value="2">正常提报</option>
                                    <option value="1">使用库存</option>
                                    <option value="3">暂不提报</option>
                                    <option value="0" selected>无状态</option>
                                </select>
                            </div>
                            <div class="form-group" >
                                <label>指定状态</label>
                                <select name="rppIsFlag" class="form-control">
                                    <option value="" selected="selected">全部</option>
                                    <option value="1">已指定</option>
                                    <option value="0">未指定</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>提报日期</label>
                                <input type="text" class="form-control datepicker" name="startTime" readonly="readonly"/>
                                <span> 至 </span>
                                <input type="text" class="form-control datepicker" name="endTime" readonly="readonly"/>
                            </div>
                            <div class="form-group">
                                <label>修改提报状态日期</label>
                                <input type="text" class="form-control datepicker" name="startTimeByEdit" readonly="readonly"/>
                                <span> 至 </span>
                                <input type="text" class="form-control datepicker" name="endTimeByEdit" readonly="readonly"/>
                            </div>
                            <button type="button" class="btn btn-success" id="btn-batch-search">
                                <span class="Bold">搜索</span>
                            </button>
                        </div>
                    </div>
                </form>-->
                <div class="row" id="out-assign-bar">
                    <div class="form-inline">
                        <a shiro:hasPermission="buy:planedit:assign" href="javascript:void(0);"
                           class="btn btn-success pull-right" style="margin-right: 10px" onclick="batchOutAssign()">
                            <span class="Bold">批量指定</span>
                        </a>
                    </div>
                </div>
                <table id="out-assign-table"></table>
            </div>
        </div>
    </div>
</div>
<!--手动指定导入-->
<div class="modal fade" id="modal-assign-plan">
    <div class="modal-dialog" style="width:1400px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">指定采购计划</h4>
            </div>
            <div class="modal-body">
                <form id="assignPlanForm" class="form-horizontal">
                    <input type="hidden" name="rppId">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划员</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanner"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">提报物料描述</label>
                                <div class="col-sm-8">
                                    <span id="rppMatDesc"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">数量</label>
                                <div class="col-sm-8">
                                    <span id="rppNum"></span>
                                </div>
                            </div>
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">实用数量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppRealNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <!--                            <div class="form-group">-->
                            <!--                                <label class="col-sm-4 text-right">余量</label>-->
                            <!--                                <div class="col-sm-8">-->
                            <!--                                    <span id="rppOverNum"></span>-->
                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="form-group">
                                <label class="col-sm-4 text-right">单位</label>
                                <div class="col-sm-8">
                                    <span id="rppUnit"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rppStandardNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">品牌</label>
                                <div class="col-sm-8">
                                    <span id="rppBrand"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目编号</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectCode"></span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-4 text-right">分类</label>
                                <div class="col-sm-8">
                                    <span id="rppTypes"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">计划号</label>
                                <div class="col-sm-8">
                                    <span id="rppPlanNo"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">项目名称</label>
                                <div class="col-sm-8">
                                    <span id="rppProjectName"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">部分</label>
                                <div class="col-sm-8">
                                    <span id="rppPart"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-4 text-right">备注</label>
                                <div class="col-sm-8">
                                    <span id="rppRemark"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-8">
                            <div class="row">
                                <div class="form-inline">
                                    <div class="form-group">
                                        <label>物料描述</label>
                                        <input type="text" name="info" class="form-control" placeholder="">
                                    </div>
                                    <button type="button" class="btn btn-success" id="btn-assign-plan-search">
                                        <span class="Bold">搜索</span>
                                    </button>
                                </div>
                            </div>
                            <table id="assign-plan-table"></table>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<section class="content-header"><h1>提报计划编辑</h1></section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" method="get">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>物料描述</label>
                                    <input type="hidden" style="display: none" name="rppMatDescArrayStr"/>
                                    <div class="form-control" name="rppMatDescArraySelect"
                                         style="OVERFLOW-Y: auto; OVERFLOW-X:hidden;width: 196px!important; display: inline-block; height:34px!important;-webkit-border-radius: 0 !important;-moz-border-radius: 0 !important;border-radius: 0 !important;">
                                    </div>
                                    <lable>
                                        <button type="button"
                                                class="btn-success btn-xs"
                                                style="
                                                font-weight: 900;
                                                border-radius: 5px"
                                                name="addRppMatDescArraySelect"><i class="glyphicon glyphicon-plus"></i>
                                        </button>
                                        <button type="button"
                                                class="btn-danger btn-xs"
                                                style="

                                                font-weight: 900;
                                                border-radius: 5px"
                                                name="subtractRppMatDescArraySelect"><i
                                                class="glyphicon glyphicon-minus"></i></button>
                                    </lable>
                                </div>
                                <div class="form-group">
                                    <label>项目编号</label>
                                    <!--<input type="text" name="rppProjectCode" class="form-control" placeholder="请输入项目编号">-->
                                    <input type="hidden" style="display: none" name="rppProjectCodeArrayStr"/>
                                    <div class="form-control" name="rppProjectCodeArraySelect"
                                         style="OVERFLOW-Y: auto; OVERFLOW-X:hidden;width: 196px!important; display: inline-block; height:34px!important;-webkit-border-radius: 0 !important;-moz-border-radius: 0 !important;border-radius: 0 !important;">
                                    </div>
                                    <lable>
                                        <button type="button"
                                                class="btn-success btn-xs"
                                                style="
                                                font-weight: 900;
                                                border-radius: 5px"
                                                name="addRppProjectCodeArraySelect"><i
                                                class="glyphicon glyphicon-plus"></i></button>
                                        <button type="button"
                                                class="btn-danger btn-xs"
                                                style="font-weight: 900;border-radius: 5px"
                                                name="subtractRppProjectCodeArraySelect"><i
                                                class="glyphicon glyphicon-minus"></i></button>
                                    </lable>
                                </div>
                                <div class="form-group">
                                    <label>项目名称</label>
                                    <input type="text" name="rppProjectName" class="form-control" placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label>计划员</label>
                                    <input type="text" name="rppPlanner" class="form-control" placeholder="请输入计划员">
                                </div>
                                <div class="form-group">
                                    <label>计划号</label>
                                    <input type="text" name="rppPlanNo" class="form-control" placeholder="请输入计划号">
                                </div>
                                <div class="form-group">
                                    <label>计划员备注</label>
                                    <input type="text" name="rppPlannerRemark" class="form-control"
                                           placeholder="请输入计划员备注">
                                </div>
                                <div class="form-group">
                                    <label>型号/标准号</label>
                                    <input type="text" name="rppStandardNo" class="form-control"
                                           placeholder="请输入型号/标准号">
                                </div>
                                <div class="form-group">
                                    <label>提报人</label>
                                    <input type="text" name="rppDesigner" class="form-control"
                                           placeholder="请输入提报人">
                                </div>
                                <div class="form-group">
                                    <label>部分</label>
                                    <input type="text" name="rppPart" class="form-control"
                                           placeholder="请输部分">
                                </div>
                                <div class="form-group">
                                    <label>提报状态</label>
                                    <select th:if="${queryModel}==null" id="rppUseStock" data-actions-box="true"
                                            class="selectpicker" multiple style="width: 90px!important;">
                                        <option value="0" selected>无状态</option>
                                        <option value="1" selected>使用库存</option>
                                        <option value="2" selected>正常提报</option>
                                        <option value="3" selected>暂不提报</option>
                                        <option value="4" selected>甲供</option>
                                    </select>
                                    <select th:if="${queryModel} != null" id="rppUseStock" data-actions-box="true"
                                            class="selectpicker" multiple style="width: 90px!important;">
                                        <option value="0">无状态</option>
                                        <option value="1" selected="selected">使用库存</option>
                                        <option value="2">正常提报</option>
                                        <option value="3">暂不提报</option>
                                        <option value="4" selected>甲供</option>
                                    </select>
                                    <input th:if="${queryModel}==null" type="hidden" name="rppUseStockStr"
                                           value="0,1,2,3,4" style="display: none">
                                    <input th:if="${queryModel}!=null" type="hidden" name="rppUseStockStr" value="1"
                                           style="display: none">
                                </div>
                                <div class="form-group">
                                    <label>分类</label>
                                    <select name="rppTypeId" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option th:each="type : ${categories}"
                                                th:selected="${type.dicName}==${queryModel}" th:value="${type.dicId}"
                                                th:text="${type.dicName}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>生产状态</label>
                                    <select name="rppProjectState" class="form-control"
                                            style="padding: 0px!important;text-align: center!important;text-align-last: center!important;width:auto!important;">
                                        <option value="" selected="selected">全部</option>
                                        <option value="-1">无状态</option>
                                        <option value="1">未开始</option>
                                        <option value="2">执行中</option>
                                        <option value="3">已完成</option>
                                        <option value="4">取消</option>
                                        <option value="5">暂缓</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>单据状态</label>
                                    <select th:if="${queryModel} == null" name="rppStatus" class="form-control">
                                        <option value="">全部</option>
                                        <option value="2" selected="selected">未提交</option>
                                        <option value="3">已提交</option>
                                    </select>
                                    <select th:if="${queryModel} != null" name="rppStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option value="2">未提交</option>
                                        <option value="3">已提交</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>指定状态</label>
                                    <select th:if="${queryModel} == null" name="rppIsFlag" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option value="1">已指定</option>
                                        <option value="0">未指定</option>
                                    </select>
                                    <select th:if="${queryModel} != null" name="rppIsFlag" class="form-control">
                                        <option value="">全部</option>
                                        <option value="1">已指定</option>
                                        <option value="0" selected="selected">未指定</option>
                                    </select>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label>提报状态是否需要修改</label>-->
<!--                                    <select th:if="${queryModel} == null" id="rppIsChangeStatusFlag"-->
<!--                                            name="rppIsChangeStatusFlag"-->
<!--                                            class="form-control">-->
<!--                                        <option value="">全部</option>-->
<!--                                        <option value="1" selected="selected">是</option>-->
<!--                                        <option value="2">否</option>-->
<!--                                    </select>-->
<!--                                    <select th:if="${queryModel} != null" id="rppIsChangeStatusFlag"-->
<!--                                            name="rppIsChangeStatusFlag"-->
<!--                                            class="form-control">-->
<!--                                        <option value="" selected="selected">全部</option>-->
<!--                                        <option value="1">是</option>-->
<!--                                        <option value="2">否</option>-->
<!--                                    </select>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label>是否是提报数量为0的计划</label>
                                    <select name="rppNumIsZero"
                                            class="form-control">
                                        <option value="">全部</option>
                                        <option value="1" selected="selected">否</option>
                                        <option value="2">是</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>提报日期</label>
                                    <input type="text" class="form-control datepicker" name="startTime"
                                           readonly="readonly"/>
                                    <span> 至 </span>
                                    <input type="text" class="form-control datepicker" name="endTime"
                                           readonly="readonly"/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>

                        </div>
                    </form>
                    <div class="row" id="toolbar">
                        <div class="form-inline">
                            <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-success pull-right" style="margin-right: 10px"
                               onclick="openImportUpdateModal()">
                                <span class="Bold">拆分导入</span>
                            </a>
                            <a id="a-export" shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-primary pull-right" style="margin-right: 10px">
                                <span class="Bold">拆分导出</span>
                            </a>
                            <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-success pull-right" style="margin-right: 10px"
                               onclick="openImportUpdateAssignModal()">
                                <span class="Bold">指定导入</span>
                            </a>
                            <a id="a-assign-export" shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-primary pull-right" style="margin-right: 10px">
                                <span class="Bold">指定导出</span>
                            </a>
                            <!--                                                        <a shiro:hasPermission="buy:planedit:assign" href="javascript:void(0);"-->
                            <!--                                                           class="btn btn-warning pull-right" style="margin-right: 10px"-->
                            <!--                                                           onclick="openOutAssignModal()">-->
                            <!--                                                            <span class="Bold">批量库存指定</span>-->
                            <!--                                                        </a>-->
                            <a href="javascript:void(0);" class="btn btn-info pull-right" style="margin-right: 10px"
                               onclick="openMapModal()">
                                <span class="Bold">拆分记录</span>
                            </a>
                            <!--                            <a shiro:hasPermission="buy:planexport:add" href="javascript:void(0);"-->
                            <!--                               class="btn btn-success pull-right" style="margin-right: 10px"-->
                            <!--                               onclick="openImportModal()">-->
                            <!--                                <span class="Bold">导入</span>-->
                            <!--                            </a>-->
                            <!--                            <a shiro:hasPermission="buy:planexport:add" href="javascript:void(0);"-->
                            <!--                               class="btn btn-primary pull-right" style="margin-right: 10px"-->
                            <!--                               onclick="openCreateModal()">-->
                            <!--                                <span class="Bold">添加</span>-->
                            <!--                            </a>-->
                            <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-warning pull-right" style="margin-right: 10px" onclick="openBatchModal()">
                                <span class="Bold">修改状态</span>
                            </a>
                            <a shiro:hasPermission="buy:planedit:edit" href="javascript:void(0);"
                               class="btn btn-success pull-right" style="margin-right: 10px" onclick="commitAll()">
                                <span class="Bold">全部提交</span>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    let table, markTable, mapTable, reportPlanTable, markInfoTable, batchTable, outAssignTable, assignPlanTable;
    var reportState = ['无状态', '使用库存', '正常提报', '暂不提报','甲供'];
    var projectState = ['无状态', '执行中', '未开始', '暂缓', '已完成','取消'];
    var projectColors = ['', "label-warning", "label-default", "label-danger", "label-success"];
    var reportColors = ['', "label-warning", "label-info", "label-primary", "label-success"];
    var reportColors2 = ['#c3c3c3', '#f8c97f', '#8de5fa', '#60a7d0', "#5cb85c"];
    var reportStatusOfMaterialControlDepartment = ['无状态', '正常提报', '暂不提报', '部分提报'];
    var reportStatusOfMaterialControlDepartmentColor = ['', 'label-info', 'label-primary', 'label-warning'];
    var infoUrl = ctx + 'buy/editReportPlan/info/';

    /**
     * 验证输入有效的整数和四位小数
     */
    function formatNumber(obj) {
        obj.value = obj.value.replace(/[^-\d.]/g, "");  //清除“数字”和“.”以外的字符
        obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        obj.value = obj.value.replace(/\-{2,}-/g, "-"); //只保留第一个. 清除多余的
        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3');//只能输入两个小数
        if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
            obj.value = obj.value;
        }
        //如果上去就写- 自动替换
        if (obj.value.indexOf("-") >= 0) {
            obj.value = obj.value.replace('-', "");
        }
        //如果上去就写.   自动补个0   形成0.
        if (obj.value.indexOf(".") == 0) {
            obj.value = "0" + obj.value;
        } else if (obj.value.indexOf(".") > 1) {
            //如果输入01.3自动变成1.3，自动去除整数部分的0
            if (obj.value.indexOf("0") == 0) {
                obj.value = obj.value.substr(1, obj.value.length - 1);
            }
        }
        //如果输入023直接变成23;自动去除整数部分的0
        if (obj.value.length > 2 && obj.value.indexOf(".") < 0) {
            if (obj.value.indexOf("0") == 0) {
                obj.value = obj.value.substr(1, obj.value.length - 1);
            }
        }
    }

    function search() {
        js.table.refresh(table);
    }

    // /** 添加模态框 */
    // function openCreateModal() {
    //     js.modal.open("modal-create");
    // }
    //
    // /** 导入模态框 */
    // function openImportModal() {
    //     js.modal.open("modal-import");
    // }

    /** 导入模态框 */
    function openImportUpdateModal() {
        js.modal.open("modal-import-update");
    }

    /** 指定导入模态框 */
    function openImportUpdateAssignModal() {
        js.modal.open("modal-import-update-assign");
    }

    /** 指定计划模态框 */
    function assignPlan() {
        openAssignPlanModal($("#editReportPlanForm input[name=rppId]").val());
    }

    /** 指定计划模态框 */
    function assignPlanSplit() {
        openAssignPlanModal($("#editSplitReportPlanForm input[name=rppId]").val());
    }

    /** 指定计划模态框 */
    function openAssignPlanModal(id) {
        js.post({
            url: ctx + "buy/editReportPlan/id",
            data: {
                id: id
            },
            success: function (result) {
                $("#assignPlanForm").fillSpan(result);
                $("#assignPlanForm").fillData(result);
                js.table.search(assignPlanTable);
                js.modal.open("modal-assign-plan");
            }
        })
    }

    /** 指定计划 */
    function assignPlanApply(id) {
        js.post({
            url: ctx + "buy/editReportPlan/assignPlan",
            data: {
                rppId: $("#assignPlanForm input[name=rppId]").val(),
                sppId: id
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.modal.hide("modal-assign-plan");
                    js.modal.hide("modal-edit");
                    js.modal.hide("modal-edit-split");
                    js.table.refresh(table);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /** 修改模态框 */
    function openEditReportPlanModal(id, status) {
        js.post({
            url: ctx + "buy/editReportPlan/id",
            data: {
                id: id
            },
            success: function (result) {
                /** 修改计划员权限 */
                if (hasP('buy:planedit:change')) {
                    $("#editReportPlanForm input[name='rppPlanner']").removeAttr('readonly');
                } else {
                    $("#editReportPlanForm input[name='rppPlanner']").attr('readonly', 'readonly');
                }
                if (result.rppStatus == 3) {
                    $("#rppUseStockByModal").hide();
                } else {
                    $("#rppUseStockByModal").show();
                }

                /** 正常提报显示指定计划按钮， 否则隐藏 */
                if (result.rppUseStock == 2) {
                    $(".assign-plan").show();
                } else {
                    $(".assign-plan").hide();
                }
                if (status === 1) {
                    $("#editReportPlanForm").fillData(result);
                    js.modal.open("modal-edit");
                    setTimeout(function () {
                        js.validate.validing("editReportPlanForm");
                    }, 500);
                } else if (status === 2) {
                    $("#editSplitReportPlanForm").fillSpan(result);
                    $("#editSplitReportPlanForm").fillData(result);
                    js.modal.open("modal-edit-split");
                }
            }
        });
    }

    /** 修改提报计划 */
    function update() {
        js.validSubmit({
            formId: "editSplitReportPlanForm",
            url: ctx + "buy/editReportPlan/edit",
            data: new FormData($("#editSplitReportPlanForm")[0]),
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(table);
                    if (mapTable) {
                        js.table.refresh(mapTable);
                    }
                    js.modal.hide("modal-edit-split");
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /** 变更提报计划模态框 */
    function openChangeReportPlanModal(id) {
        js.post({
            url: ctx + "buy/editReportPlan/id",
            data: {id: id},
            success: function (result) {
                $("#changeReportPlanForm").fillData(result);
                $("#changeReportPlanForm").fillSpan(result);
                // $("#changeReportPlanForm [name='rppId']").val(result.rppId);
                js.modal.open("modal-change");
                setTimeout(function () {
                    js.validate.validing("changeReportPlanForm");
                }, 500);
            }
        })
    }

    /** 修改计划员模态框 */
    function openEditPlannerModal(row) {
        $("#editPlannerForm").fillData(row);
        js.modal.open('modal-edit-planner');
    }


    /** 提交提报计划 */
    function commitReportPlan(id) {
        js.confirmPost({
            content: "确认提交吗？",
            url: ctx + "buy/editReportPlan/commit",
            data: {
                id: id
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(table);
                    if (mapTable) {
                        js.table.refresh(mapTable);
                    }
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /** 批量提交提报计划 */
    function commitAll() {
        var arr = js.table.selectColumns(table, "rppId");
        if (arr.length < 1) {
            js.modal.alert("请选择要提交的计划");
            return;
        }
        js.post({
            url: ctx + "buy/editReportPlan/commitAll",
            data: {
                rppIds: js.table.selectColumns(table, "rppId")
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(table);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        })
    }

    /** 删除提报计划 - 删除待审 */
    function deleteReportPlan(id) {
        js.modal.prompt("请编辑删除原因", function (reason) {
            if (reason == null) {
                return;
            }
            if (reason) {
                js.post({
                    url: ctx + "buy/editReportPlan/delete",
                    data: {
                        id: id,
                        reason: reason
                    },
                    success: function (result) {
                        if (result.type === web_status.SUCCESS) {
                            js.modal.success(result.msg);
                            js.table.refresh(table);
                            if (mapTable) {
                                js.table.refresh(mapTable);
                            }
                        } else {
                            js.modal.warning(result.msg);
                        }
                    }
                })

            } else {
                js.modal.alert("请输入删除原因");
            }
        });
    }

    /** 撤消提报计划 */
    function cancelReportPlan(id) {
        if (id == '') {
            var arr = js.table.selectColumns(table, "rppId");
            if (arr.length < 1) {
                js.modal.alert("请选择要撤销的计划");
                return;
            }
            js.confirmPost({
                content: "确认撤消当前页选中的提报计划吗？",
                url: ctx + "buy/editReportPlan/cancels",
                data: {
                    rppIds: js.table.selectColumns(table, "rppId")
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            })
        } else {
            js.confirmPost({
                content: "确认撤消吗？",
                url: ctx + "buy/editReportPlan/cancel",
                data: {
                    id: id
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        if (mapTable) {
                            js.table.refresh(mapTable);
                        }
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        }
    }

    /** 批量修改提报状态模态框 */
    function openBatchModal() {
        js.table.search(batchTable);
        js.modal.open("modal-batch");
    }

    /** 批量修改提报状态 */
    function batchUpdate(status) {
        var arr = js.table.selectColumns(batchTable, "rppId");
        if (arr.length < 1) {
            js.modal.alert("请选择要修改的计划");
            return;
        }
        js.post({
            url: ctx + "buy/editReportPlan/batch/status",
            data: {
                rppIds: js.table.selectColumns(batchTable, "rppId"),
                status: status
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(batchTable);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        })
        js.table.refresh(table);
    }


    /** 拆分模态框 */
    function openSplitModal(row) {
        $("#splitForm").fillData(row);
        $("#splitForm").fillSpan(row);
        $("#splitForm input[name=desc]").val(row.rppMatDesc);
        js.modal.open("modal-split");
    }

    /** 验证拆分后数量与原量是否相等 */
    function validNum() {
        var srcNum = +$("#splitForm span[id=rppNum]").text();
        var descNum = $("#splitForm input[name=num]").map((i, v) => +$(v).val()).get().reduce((x, y) => x + y);
        return srcNum === descNum;
    }

    /** 拆分提报计划 */
    function split() {
        js.submit({
            url: ctx + "buy/editReportPlan/split",
            data: new FormData($("#splitForm")[0]),
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(table);
                    if (mapTable) {
                        js.table.refresh(mapTable);
                    }
                    js.modal.hide("modal-split");
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /** 拆分信息模态框 */
    function openMapModal() {
        js.table.search(mapTable);
        js.modal.open("modal-map");
    }


    /** 指定提报计划模态框 */
    function openMarkReportPlanModal(row) {
        $("#markForm").fillSpan(row);
        $("#markForm input[name=rppId]").val(row.rppId);
        $("#markForm input[name=code]").val(row.rppProjectCode);
        $("#markForm input[name=info]").val(row.rppMatDesc);
        $("#markForm input[name='name']").val(row.rppProjectName);
        $("#markForm input[name=rppAssignDesc]").val(row.rppAssignDesc);
        $("#markForm input[name=rppAssignUseStockPrice]").val(row.rppAssignUseStockPrice);
        if (row.rppDiyAssignUseStockNum != null) {
            $("#markForm input[name=rppDiyAssignUseStockNum]").val(row.rppDiyAssignUseStockNum);
        } else {
            $("#markForm input[name=rppDiyAssignUseStockNum]").val(row.rppNum);
        }
        if (row.rppDiyAssignUseStockUnit != null) {
            $("#markForm input[name=rppDiyAssignUseStockUnit]").val(row.rppDiyAssignUseStockUnit);
        } else {
            $("#markForm input[name=rppDiyAssignUseStockUnit]").val(row.rppUnit);
        }
        // $("#markForm input[name=standardNo]").val(row.rppStandardNo);
        js.table.search(markTable);
        js.modal.open("modal-mark");
    }

    /** 指定提报计划 */
    function mark() {
        let arrColumn = markTable.bootstrapTable('getSelections');
        let idStr = "";
        for (let i = 0; i < arrColumn.length; i++) {
            idStr += arrColumn[i].id + '☯';
        }
        idStr = idStr.substring(0, idStr.length - 1);
        js.post({
            url: ctx + "buy/editReportPlan/mark",
            data: {
                rppId: $("#markForm input[name=rppId]").val(),
                idStr: idStr
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.modal.hide("modal-mark")
                    js.table.refresh(table);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /** 查看指定信息模态框 */
    function openMarkInfoModal(row) {
        let data = [];
        data.push(row);
        js.table.load(reportPlanTable, data);
        js.table.jump(markInfoTable, infoUrl + row.rppId);
        js.modal.open("modal-info");
    }


    /** 外购件指定模态框 */
    function openOutAssignModal() {
        js.table.refresh(outAssignTable);
        js.modal.open("modal-out-assign");
    }

    /** 外购件批量指定 */
    function batchOutAssign() {
        var arr = js.table.selectColumns(outAssignTable, "rppId");
        if (arr.length < 1) {
            js.modal.alert("请选择要指定的计划");
            return;
        }
        js.post({
            url: ctx + "buy/editReportPlan/outAssign/batch",
            data: {
                rppIds: js.table.selectColumns(outAssignTable, "rppId")
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(outAssignTable);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        })
    }

    /** 外购件指定 */
    function outAssign(rppId) {
        js.confirmPost({
            content: "确认指定吗？",
            url: ctx + "buy/editReportPlan/outAssign",
            data: {
                rppId: rppId
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    js.modal.success(result.msg);
                    js.table.refresh(outAssignTable);
                } else {
                    js.modal.warning(result.msg);
                }
            }
        });
    }

    /**单删物料描述*/
    function deleteRppMatDescArraySelect(obj) {
        var selectArr = $("#queryForm [name='rppMatDescArrayStr']").val().split(',');
        delete selectArr[$(obj).parent().attr("data-index")];
        var selectVal = selectArr.join(',');
        if (selectVal[selectVal.length - 1] == ',') {
            selectVal = selectVal.substring(0, selectVal.length - 1);
        }
        if (selectVal[0] == ',') {
            selectVal = selectVal.substring(1, selectVal.length);
        }
        if (selectVal.length == 0) {
            $("#queryForm [name='rppMatDescArraySelect']").css("width", "196px");
        }
        $("#queryForm [name='rppMatDescArrayStr']").val(selectVal);
        $(obj).parent().remove();
        if ($("#queryForm [name='rppMatDescArraySelect']").width() < 196) {
            $("#queryForm [name='rppMatDescArraySelect']").css("width", "196px");
        }
    }

    /**单删项目编号*/
    function deleterppProjectCodeArraySelect(obj) {
        var selectArr = $("#queryForm [name='rppProjectCodeArrayStr']").val().split(',');
        delete selectArr[$(obj).parent().attr("data-index")];
        var selectVal = selectArr.join(',');
        if (selectVal[selectVal.length - 1] == ',') {
            selectVal = selectVal.substring(0, selectVal.length - 1);
        }
        if (selectVal[0] == ',') {
            selectVal = selectVal.substring(1, selectVal.length);
        }
        if (selectVal.length == 0) {
            $("#queryForm [name='rppProjectCodeArraySelect']").css("width", "196px");
        }
        $("#queryForm [name='rppProjectCodeArrayStr']").val(selectVal);
        $(obj).parent().remove();
        if ($("#queryForm [name='rppProjectCodeArraySelect']").width() < 196) {
            $("#queryForm [name='rppProjectCodeArraySelect']").css("width", "196px");
        }
    }

    /**批量删项目编号*/
    function deleterppBatchFormProjectCodeArraySelect(obj) {
        var selectArr = $("#batchForm [name='rppProjectCodeArrayStr']").val().split(',');
        delete selectArr[$(obj).parent().attr("data-index")];
        var selectVal = selectArr.join(',');
        if (selectVal[selectVal.length - 1] == ',') {
            selectVal = selectVal.substring(0, selectVal.length - 1);
        }
        if (selectVal[0] == ',') {
            selectVal = selectVal.substring(1, selectVal.length);
        }
        if (selectVal.length == 0) {
            $("#batchForm [name='rppProjectCodeArraySelect']").css("width", "196px");
        }
        $("#batchForm [name='rppProjectCodeArrayStr']").val(selectVal);
        $(obj).parent().remove();
        if ($("#batchForm [name='rppProjectCodeArraySelect']").width() < 196) {
            $("#batchForm [name='rppProjectCodeArraySelect']").css("width", "196px");
        }
    }

    $(function () {
        $("title").html($("title").html() + " —— 提报计划编辑");

        /** 下载导入失败excel */
        $("#download-error-assign").click(function () {
            var that = $(this);
            js.post({
                url: ctx + "buy/editReportPlan/exist",
                async: false,
                data: {
                    url: that.attr("data-url")
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        that.attr("href", that.attr("data-url") + "?timeStamp=" + new Date().getTime());
                    } else {
                        js.modal.warning("没有需要处理的文件");
                    }
                }
            });
        });
        /** 下载导入失败excel */
        $("#download-error-split").click(function () {
            var that = $(this);
            js.post({
                url: ctx + "buy/editReportPlan/exist",
                async: false,
                data: {
                    url: that.attr("data-url")
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        that.attr("href", that.attr("data-url") + "?timeStamp=" + new Date().getTime());
                    } else {
                        js.modal.warning("没有需要处理的文件");
                    }
                }
            });
        });

        /**添加物料描述*/
        $("#queryForm [name='addRppMatDescArraySelect']").click(function () {
            js.modal.prompt("请输入要搜索的物料描述", function (result) {
                if (result != null && result != "") {
                    $("#queryForm [name='rppMatDescArraySelect']").css("width", "auto");
                    var idVal = $("#queryForm [name='rppMatDescArraySelect']").children("span").length;
                    var optionHtml = '<span data-index="' + idVal + '" data="' + result + '" style="font-size: 16px; margin: 5px;border: #8B8986 1px solid;border-radius: 5px;background-color: #e9e9e9;color: #333333;padding-left: 5px;padding-right: 5px" value="' + result + '">' + result + '' +
                        '<button onclick="deleteRppMatDescArraySelect(this)" onmouseover="this.style.color=\'white\';" onmouseout="this.style.color=\'#333333\';" type="button" style="outline: none;border: 0;background: transparent" name="btn_close">×</button></span>';
                    $("#queryForm [name='rppMatDescArraySelect']").append(optionHtml);
                    if ($("#queryForm [name='rppMatDescArraySelect']").width() < 196) {
                        $("#queryForm [name='rppMatDescArraySelect']").css("width", "196px");
                    }
                    var vals = "";
                    $("#queryForm [name='rppMatDescArraySelect']").children("span").each(function () {
                        vals += $(this).attr("data") + ",";
                    });
                    vals = vals.substring(0, vals.length - 1);
                    $("#queryForm [name='rppMatDescArrayStr']").val(vals);
                }
            })
        });

        /** 清空物料描述 */
        $("#queryForm [name='subtractRppMatDescArraySelect']").click(function () {
            $("#queryForm [name='rppMatDescArraySelect']").css("width", "196px");
            $("#queryForm [name='rppMatDescArraySelect']").empty();
            $("#queryForm [name='rppMatDescArrayStr']").val('');
        });


        /**添加项目编号*/
        $("#queryForm [name='addRppProjectCodeArraySelect']").click(function () {
            js.modal.prompt("请输入要搜索的项目编号", function (result) {
                if (result != null && result != "") {
                    $("#queryForm [name='rppProjectCodeArraySelect']").css("width", "auto");
                    var idVal = $("#queryForm [name='rppProjectCodeArraySelect']").children("span").length;
                    var optionHtml = '<span data-index="' + idVal + '" data="' + result + '" style="font-size: 16px; margin: 5px;border: #8B8986 1px solid;border-radius: 5px;background-color: #e9e9e9;color: #333333;padding-left: 5px;padding-right: 5px" value="' + result + '">' + result + '' +
                        '<button onclick="deleterppProjectCodeArraySelect(this)" onmouseover="this.style.color=\'white\';" onmouseout="this.style.color=\'#333333\';" type="button" style="outline: none;border: 0;background: transparent" name="btn_close">×</button></span>';
                    $("#queryForm [name='rppProjectCodeArraySelect']").append(optionHtml);
                    if ($("#queryForm [name='rppProjectCodeArraySelect']").width() < 196) {
                        $("#queryForm [name='rppProjectCodeArraySelect']").css("width", "196px");
                    }
                    var vals = "";
                    $("#queryForm [name='rppProjectCodeArraySelect']").children("span").each(function () {
                        vals += $(this).attr("data") + ",";
                    });
                    vals = vals.substring(0, vals.length - 1);
                    $("#queryForm [name='rppProjectCodeArrayStr']").val(vals);
                }
            })
        });

        /**
         * 提报状态改变事件
         */
        $("#rppUseStock").on('change', function () {
            $("#queryForm input[name='rppUseStockStr']").val($("#rppUseStock").val());
        });

        /**
         * 提报状态改变事件
         */
        $("#rppUseStock2").on('change', function () {
            $("#batchForm input[name='rppUseStockStr']").val($("#rppUseStock2").val());
        });
        /**
         * 生产状态改变事件
         */
        $("#rppProjectState").on('change', function () {
            $("#queryForm input[name='rppProjectStateStr']").val($("#rppProjectState").val());
        });


        /** 清空项目编号 */
        $("#queryForm [name='subtractRppProjectCodeArraySelect']").click(function () {
            $("#queryForm [name='rppProjectCodeSelect']").css("width", "196px");
            $("#queryForm [name='rppProjectCodeArraySelect']").empty();
            $("#queryForm [name='rppProjectCodeArrayStr']").val('');
        });
        /**添加项目编号*/
        $("#batchForm [name='addRppProjectCodeArraySelect']").click(function () {
            js.modal.prompt("请输入要搜索的项目编号", function (result) {
                if (result != null && result != "") {
                    $("#batchForm [name='rppProjectCodeArraySelect']").css("width", "auto");
                    var idVal = $("#batchForm [name='rppProjectCodeArraySelect']").children("span").length;
                    var optionHtml = '<span data-index="' + idVal + '" data="' + result + '" style="font-size: 16px; margin: 5px;border: #8B8986 1px solid;border-radius: 5px;background-color: #e9e9e9;color: #333333;padding-left: 5px;padding-right: 5px" value="' + result + '">' + result + '' +
                        '<button onclick="deleterppBatchFormProjectCodeArraySelect(this)" onmouseover="this.style.color=\'white\';" onmouseout="this.style.color=\'#333333\';" type="button" style="outline: none;border: 0;background: transparent" name="btn_close">×</button></span>';
                    $("#batchForm [name='rppProjectCodeArraySelect']").append(optionHtml);
                    if ($("#batchForm [name='rppProjectCodeArraySelect']").width() < 196) {
                        $("#batchForm [name='rppProjectCodeArraySelect']").css("width", "196px");
                    }
                    var vals = "";
                    $("#batchForm [name='rppProjectCodeArraySelect']").children("span").each(function () {
                        vals += $(this).attr("data") + ",";
                    });
                    vals = vals.substring(0, vals.length - 1);
                    $("#batchForm [name='rppProjectCodeArrayStr']").val(vals);
                }
            })
        });

        /** 清空项目编号 */
        $("#batchForm [name='subtractRppProjectCodeArraySelect']").click(function () {
            $("#batchForm [name='rppProjectCodeSelect']").css("width", "196px");
            $("#batchForm [name='rppProjectCodeArraySelect']").empty();
            $("#batchForm [name='rppProjectCodeArrayStr']").val('');
        });


        /** 提报计划表 */
        table = js.table.init({
            url: ctx + "buy/editReportPlan/list",
            paginationVAlign: 'both',
            pageSize: 15,
            pageList: [10, 15, 25, 50, 100, 300, 1000],               // 可供选择的每页的行数
            showColumns: true,
            showExport: false,
            showRefresh: true,
            clickToSelect: true,
            exportDataType: 'basic',
            exportTypes: ['csv', 'txt', 'sql', 'doc', 'excel', 'xlsx', 'pdf'],
            exportOptions: {
                ignoreColumn: [0, 19],  //忽略某一列的索引
                fileName: '提报计划列表',  //文件名称设置
                worksheetName: '提报计划列表',  //表格工作区名称
                tableName: '提报计划列表',
                // excelstyles: ['background-color', 'color', 'font-size', 'font-weight'], 设置格式
            },
            uniqueId: "rppId",
            onLoadSuccess: function () {
                // js.post({
                //     url: ctx + 'buy/editReportPlan/getRppIsChangeStatusFlagCount',
                //     async: false,
                //     data: $('#queryForm').serialize(),
                //     success: function (result) {
                //         if (result.type === web_status.SUCCESS) {
                //             var num1 = 0;
                //             var num2 = 0;
                //             for (var i = 0; i < result.data.length; i++) {
                //                 if (result.data[i].rppTypes == '是') {
                //                     num1 = result.data[i].num;
                //                 }
                //                 if (result.data[i].rppTypes == '否') {
                //                     num2 = result.data[i].num;
                //                 }
                //             }
                //             $("#rppIsChangeStatusFlag option").each(function () {
                //                 if ($(this).val() == 1) {
                //                     $(this).html('是 【' + num1 + '】');
                //                 } else if ($(this).val() == 2) {
                //                     $(this).html('否 【' + num2 + '】');
                //                 }
                //             })
                //         } else {
                //             js.modal.warning(result.msg)
                //         }
                //
                //
                //     }
                // });
                /** 指定库存表 */
                batchTable = js.table.init({
                    id: "batch-table",
                    toolbar: '#batchBar',
                    showColumns: false,
                    queryForm: 'batchForm',
                    showExport: false,
                    url: ctx + "buy/editReportPlan/batchChangeList",
                    firstLoad: false,
                    columns: [
                        {
                            checkbox: true,
                            width: '30px'
                        },
                        {
                            title: '序号', field: 'id', width: '50px',
                            formatter: function (value, row, index, field) {
                                return index + 1;
                            }
                        },
                        {title: "计划员", field: 'rppPlanner'},
                        {
                            title: "物料描述", field: 'rppMatDesc',
                            formatter: function (value, row, index, field) {
                                if (value && value.length > 50) {
                                    return '<span title="' + value + '">' + value.substring(0, 50) + '</span> ';
                                } else {
                                    return value;
                                }
                            }
                        },
                        {
                            title: "图号", field: 'rppDiagram',
                            formatter: function (value, row, index, field) {

                                return value;

                            }
                        },
                        {title: "数量", field: 'rppNum'},
                        // {title: "实用", field: 'rppRealNum'},
                        // {title: "余量", field: 'rppOverNum'},
                        {title: "单位", field: 'rppUnit'},
                        {title: "型号/标准号", field: 'rppStandardNo'},
                        {title: "分类", field: 'rppTypes'},
                        {title: "品牌", field: 'rppBrand'},

                        {title: "备注", field: 'rppRemark', width: '60px'},
                        {title: "项目编号", field: 'rppProjectCode'},
                        {title: "项目名称", field: 'rppProjectName'},
                        {title: "提报人", field: 'rppDesigner'},
                        {title: "提报人<br>联系方式", field: 'rppDesignerTel'},
                        {
                            title: "是否使<br>用库存", field: 'rppUseStore',
                            formatter: function (value, row, index) {
                                if (value === null) {
                                    return "--";
                                } else if (value === 0) {
                                    return "否";
                                } else if (value === 1) {
                                    return "是";
                                }
                            }
                        },
                        {
                            title: "生产状态", field: 'rppProjectStateStr',
                            formatter: function (value, row, index) {
                                return value;
                            }
                        },
                        {
                            title: "提报状态", field: 'rppUseStock',
                            formatter: function (value, row, index) {
                                if (value == null) {
                                    value = 0
                                }
                                if (row.orderColumn == 2) {
                                    return '<span class="badge ' + reportColors[value] + '">' + reportState[value] + '</span> ';
                                } else {
                                    return '<span class="badge" style="background-color:' + reportColors2[value] + '" >' + reportState[value] + '</span> ';
                                }
                            }
                        },


                        // {
                        //     title: "生产状态", field: 'rppProjectState',
                        //     formatter: function (value, row, index) {
                        //         if (value) {
                        //             return '<span class="badge ' + projectColors[value] + '">' + projectState[value] + '</span> ';
                        //         }
                        //     }
                        // },
                        {title: "计划号", field: 'rppPlanNo'},
                        {title: "提报日期", field: 'rppCreateTime', width: '90px'},
                        {title: "计划员备注", field: 'rppPlannerRemark'}
                    ]
                });
            },
            columns: [
                {
                    checkbox: true,
                    width: '30px',
                    formatter: function (value, row, index) {
                        if ((sessionUser.name == row.rppPlanner || '管理员' == sessionUser.name) && row.rppStatus === 2 && row.rppUseStock === 2) {
                            return {disabled: false}
                        } else {
                            return {disabled: true}
                        }
                    }
                },
                {
                    title: '序号', field: 'id', width: '50px',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: "计划员", field: 'rppPlanner'},
                {
                    title: "物料描述", field: 'rppMatDesc',
                    formatter: function (value, row, index, field) {
                        if (value && value.length > 50) {
                            return '<span title="' + value + '">' + value.substring(0, 50) + '</span> ';
                        } else {
                            return value;
                        }
                    }
                },
                {
                    title: "图号", field: 'rppDiagram',
                    formatter: function (value, row, index, field) {

                        return value;

                    }
                },
                {title: "数量", field: 'rppNum'},
                // {title: "实用", field: 'rppRealNum'},
                // {title: "余量", field: 'rppOverNum'},
                {title: "单位", field: 'rppUnit'},
                {title: "型号/标准号", field: 'rppStandardNo'},
                {title: "分类", field: 'rppTypes'},
                {title: "外协类型", field: 'rppAssistType'},
                {title: "品牌", field: 'rppBrand'},
                {title: "备注", field: 'rppRemark', width: '100px',
                    formatter: function (value, row, index) {
                        return '<p  style="word-wrap: break-word;width: 90px">' + value + '</p>';
                    }},
                {title: "部分", field: 'rppPart'},
                {title: "项目编号", field: 'rppProjectCode'},
                {title: "项目名称", field: 'rppProjectName'},
                {title: "提报人", field: 'rppDesigner'},
                {title: "提报人<br>联系方式", field: 'rppDesignerTel'},
                {
                    title: "是否使<br>用库存", field: 'rppUseStore',
                    formatter: function (value, row, index) {
                        if (value === null) {
                            return "--";
                        } else if (value === 0) {
                            return "否";
                        } else if (value === 1) {
                            return "是";
                        }
                    }
                },
                {
                    title: "生产状态", field: 'rppProjectStateStr',
                    formatter: function (value, row, index) {
                        return value;
                    }
                },
                {
                    title: "提报状态", field: 'rppUseStock',
                    formatter: function (value, row, index) {
                        if (value == null) {
                            value = 0
                        }
                        if (row.orderColumn == 2) {
                            return '<span class="badge ' + reportColors[value] + '">' + reportState[value] + '</span> ';
                        } else {
                            return '<span class="badge" style="background-color:' + reportColors2[value] + '" >' + reportState[value] + '</span> ';
                        }
                    }
                },
                // {
                //     title: "提报状态<br>编辑时间", field: 'rppEditTime', width: '75',
                //     formatter: function (value, row, index) {
                //         return value;
                //     }
                // },
                {title: "计划号", field: 'rppPlanNo'},
                {title: "生产编号", field: 'rppProduceCode'},
                {title: "提报日期", field: 'rppCreateTime', width: '90px'},
                {title: "计划员备注", field: 'rppPlannerRemark', width: '60px'},
                {
                    title: "附件", field: 'rppExtendUrl', formatter: function (value, row, index) {
                        if (value != null) {
                            let elements = [];
                            // if(hasP('buy:planedit:edit')){
                            //     elements.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="look(' + row.id + ',' + row.recMark + ')"><i class="fa  fa-search"></i> 查看</a> ');
                            // }
                            if (hasP('buy:planedit:edit')) {
                                elements.push('<a class="btn btn-primary btn-xs" href="/buy/getReportPlanList/download/' + row.rppResultId + '/' + 1 + '"><i class="glyphicon glyphicon-download-alt"></i> 下载</a> ');
                            }
                            return elements.join('');
                        } else {
                            return "";
                        }
                    }
                },
                {
                    title: "操作",
                    width: '110px',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // 改计划员
                        /*if (hasP('buy:planedit:change')) {
                            actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openEditPlannerModal(' + js.jsonStringify(row) + ')"> 编辑</a> ');
                        }*/
                        if (sessionUser.name == row.rppPlanner || '管理员' == sessionUser.name) {
                            // 未提交状态
                            if (row.rppStatus === 2) {
                                // 未提交， 已指定 可以查看
                                if (row.rppIsFlag === 1 && hasP("buy:planedit:assign")) {
                                    actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="openMarkInfoModal(' + js.jsonStringify(row) + ')"> 查看</a> ');
                                }
                                // 未提交，未标记的可以修改
                                if (row.rppIsFlag === 0 && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openEditReportPlanModal(' + row.rppId + ',' + row.rppOriginalFlag + ')"> 修改</a> ');
                                }
                                // 未提交， 未标记、非甲供的可以拆分
                                if (row.rppUseStock != 4 && row.rppIsFlag === 0 && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="openSplitModal(' + js.jsonStringify(row) + ')"> 拆分</a> ');
                                }
                                // 未提交， 正常提报可以提交
                                if (row.rppUseStock === 2 && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="commitReportPlan(' + row.rppId + ')"> 提交</a> ');
                                }
                                // 未提交， 使用库存，可以标记
                                if (row.rppUseStock === 1 && hasP("buy:planedit:assign")) {
                                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="openMarkReportPlanModal(' + js.jsonStringify(row) + ')"> 指定</a> ');
                                }
                                // 未指定， 未提交， 原始计划的可以删除
                                if (row.rppOriginalFlag === 1 && row.rppIsFlag === 0 && hasP("buy:planedit:del")) {
                                    actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="deleteReportPlan(' + row.rppId + ')"> 删除</a> ');
                                }
                            } else if (row.rppStatus === 3) { // 已提交状态
                                // 已提交， 正常提报，采购计划未提交的可以撤消
                                if ((!row.sppStatus || row.sppStatus === 1) && row.rppUseStock === 2 && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="cancelReportPlan(' + row.rppId + ')"> 撤消</a> ');
                                }
                                // 已提交， 正常提报的可以变更
                                if (row.rppUseStock === 2 && row.rppSppId == null && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openEditReportPlanModal(' + row.rppId + ',' + row.rppOriginalFlag + ')"> 修改</a> ');
                                }
                                // 已提交， 正常提报的可以变更
                                if (row.rppUseStock === 2 && row.rppSppId != null && hasP("buy:planedit:alter")) {
                                    actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openChangeReportPlanModal(' + row.rppId + ')"> 变更</a> ');
                                }
                            }
                        }
                        return actions.join('');
                    }
                }
            ]
        });


        /** 表格搜索 */
        $("#btn-search").click(function () {
            js.table.search(table);
            js.table.refresh(batchTable);
        });


        /** 添加表单验证规则 */
        js.validate.init("createReportPlanForm", {
            fields: {
                rppProjectCode: {
                    validators: {
                        notEmpty: {message: '请输入项目编号'},
                        remote: {
                            url: ctx + "buy/editReportPlan/checkProjectCode",
                            message: '项目编号不存在',
                            delay: 500,
                            type: 'POST'
                        },
                    }
                },
                rppProjectName: {validators: {notEmpty: {message: '请输入项目名称'}}},
                rppMatDesc: {validators: {notEmpty: {message: '请输入物料描述'}}},
                rppNum: {validators: {notEmpty: {message: '请输入数量'}}},
                rppUnit: {validators: {notEmpty: {message: '请输入单位'}}},

            }
        });
        /** 添加模态框隐藏事件 */
        js.modal.hideEvent("modal-create", function () {
            js.validate.reset("createReportPlanForm");
            js.reset("createReportPlanForm");
        });
        /** 添加提报计划 */
        $("#btn-create-report-plan").click(function () {
            js.validSubmit({
                formId: "createReportPlanForm",
                url: ctx + "buy/editReportPlan/create",
                data: new FormData($("#createReportPlanForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        js.modal.hide("modal-create");
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        });


        /** 导入表单验证 */
        js.validate.init("importForm", {
            fields: {
                file: {
                    validators: {
                        notEmpty: {message: '上传文件不能为空'},
                        file: {extension: 'xls,xlsx', message: '请选择excel文件'}
                    }
                }
            }
        });
        /** 导入模态框隐藏事件 */
        js.modal.hideEvent("modal-import", function () {
            js.validate.reset("importForm");
            js.reset("importForm");
        });
        /** 导入提报计划 */
        $("#btn-upload").click(function () {
            var $this = $(this);
            $this.attr('disabled', true);
            js.validSubmit({
                formId: "importForm",
                url: ctx + "buy/editReportPlan/import",
                data: new FormData($("#importForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.alert(result.msg);
                        if (result.msg == '导入完成') {
                            js.modal.hide("modal-import");
                        }
                        js.table.refresh(table);
                        // js.modal.hide("modal-import");
                        $this.attr('disabled', false);
                    }
                }
            });
        });
        /** 下载导入失败excel */
        $("#download-error").click(function () {
            var that = $(this);
            js.post({
                url: ctx + "buy/editReportPlan/exist",
                async: false,
                data: {
                    url: that.attr("data-url")
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        that.attr("href", that.attr("data-url") + "?timeStamp=" + new Date().getTime());
                    } else {
                        js.modal.warning("没有需要处理的文件");
                    }
                }
            });
        });


        /** 暂缓导入表单验证 */
        js.validate.init("importFormUpdate", {
            fields: {
                file: {
                    validators: {
                        notEmpty: {message: '上传文件不能为空'},
                        file: {extension: 'xls,xlsx', message: '请选择excel文件'}
                    }
                }
            }
        });
        /** 指定导入表单验证 */
        js.validate.init("importFormUpdateAssign", {
            fields: {
                file: {
                    validators: {
                        notEmpty: {message: '上传文件不能为空'},
                        file: {extension: 'xls,xlsx', message: '请选择excel文件'}
                    }
                }
            }
        });
        /** 暂缓导入模态框隐藏事件 */
        js.modal.hideEvent("modal-import-update", function () {
            js.validate.reset("importFormUpdate");
            js.reset("importFormUpdate");
        });
        /** 暂缓导入提报计划 */
        $("#btn-upload-update").click(function () {
            var $this = $(this);
            $this.attr('disabled', true);
            js.validSubmit({
                formId: "importFormUpdate",
                url: ctx + "buy/editReportPlan/import/edit",
                data: new FormData($("#importFormUpdate")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.alert(result.msg);
                        if (result.msg == '导入完成') {
                            js.modal.hide("modal-import");
                        }
                        js.table.refresh(table);
                        // js.modal.hide("modal-import");
                        $this.attr('disabled', false);
                    }
                }
            });
        });

        /** 指定导入提报计划 */
        $("#btn-upload-update-Assign").click(function () {
            var $this = $(this);
            $this.attr('disabled', true);
            js.validSubmit({
                formId: "importFormUpdate",
                url: ctx + "buy/editReportPlan/import/editAssign",
                data: new FormData($("#importFormUpdateAssign")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.alert(result.msg);
                        if (result.msg == '导入完成') {
                            js.modal.hide("modal-import-update-assign");
                        }
                        js.table.refresh(table);
                        $this.attr('disabled', false);
                    }
                }
            });
        });
        /** 下载暂缓导入失败excel */
        $("#download-error-update").click(function () {
            var that = $(this);
            js.post({
                url: ctx + "buy/editReportPlan/exist",
                async: false,
                data: {
                    url: that.attr("data-url")
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        that.attr("href", that.attr("data-url") + "?timeStamp=" + new Date().getTime());
                    } else {
                        js.modal.warning("没有需要处理的文件");
                    }
                }
            });
        });


        /** 修改计划员表单验证规则 */
        js.validate.init("editPlannerForm", {
            fields: {
                rppPlanner: {validators: {notEmpty: {message: '请输入计划员'}}}
            }
        });
        /** 修改计划员 */
        $("#btn-edit-planner").click(function () {
            js.validSubmit({
                formId: "editPlannerForm",
                url: ctx + "buy/editReportPlan/edit/planner",
                data: new FormData($("#editPlannerForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        if (mapTable) {
                            js.table.refresh(mapTable);
                        }
                        js.modal.hide("modal-edit-planner");
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        });
        /** 修改计划员模态框隐藏事件 */
        js.modal.hideEvent("modal-edit-planner", function () {
            js.validate.reset("editPlannerForm");
            js.reset("editPlannerForm");
        });


        /** 修改提报计划信息表单验证规则 */
        js.validate.init("editReportPlanForm", {
            fields: {
                rppPlanner: {validators: {notEmpty: {message: '请输入计划员'}}},
                rppMatDesc: {validators: {notEmpty: {message: '请输入物料描述'}}},
                rppProjectName: {validators: {notEmpty: {message: '请输入项目名称'}}}
            }
        });
        /** 修改提报计划模态框隐藏事件 */
        js.modal.hideEvent("modal-edit", function () {
            js.validate.reset("editReportPlanForm");
            js.reset("editReportPlanForm");
        });
        /** 修改提报计划 */
        $("#btn-edit-report-plan").click(function () {
            // // 非原材料类型，有余量没有实用数量的给出提示
            // let typeName = $("#editReportPlanForm select[name=rppTypeId]").find("option:selected").text();
            // let overNum = $("#editReportPlanForm input[name=rppOverNum]").val();
            // let realNum = $("#editReportPlanForm input[name=rppRealNum]").val();
            // if (typeName != '原材料' && overNum && !realNum) {
            //     js.modal.alert("请添写实用数量");
            //     return;
            // }
            js.validSubmit({
                formId: "editReportPlanForm",
                url: ctx + "buy/editReportPlan/edit",
                data: new FormData($("#editReportPlanForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        if (mapTable) {
                            js.table.refresh(mapTable);
                        }
                        js.modal.hide("modal-edit");
                        js.modal.hide("modal-edit-split");
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        });


        /** 修改拆分后的提报计划信息表单验证规则 */
        js.validate.init("editSplitReportPlanForm", {
            fields: {
                rppNum: {validators: {notEmpty: {message: '请输入数量'}}}
            }
        });
        /** 修改提报计划模态框隐藏事件 */
        js.modal.hideEvent("modal-edit-split", function () {
            js.validate.reset("editSplitReportPlanForm");
            js.reset("editSplitReportPlanForm");
        });
        /** 修改提报计划 */
        $("#btn-edit-split-report-plan").click(function () {
            var srcNum = +$("#srcNum").text();
            var alreadySplitNum = +$("#alreadySplitNum").text();
            var currNum = +$("#editSplitReportPlanForm input[name=rppNum]").val();
            if (alreadySplitNum + currNum !== srcNum) {
                js.modal.confirm("拆分数据总数量与原数量不符，继续修改吗？", () => {
                    update();
                });
            } else {
                update();
            }
        });


        /** 追加拆分表单 */
        $("#btn-append").click(function () {
            $("#div-append").append(
                `
                <div class="row">
                    <div class="col-md-3">
                        <div class="form-group">
                            <div class="col-md-12">
                                <input type="text" class="form-control" name="desc" autocomplete="off" placeholder="物料描述">
                            </div>

                        </div>
                    </div>
                    <div class="col-md-2">
                        <div class="form-group">
                            <div class="col-md-12">
                                <input type="number" step="0.1" class="form-control" name="num" placeholder="拆分数量">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <div class="col-md-12">
                                <select class="form-control" name="status" title="">
                                    <option value="2" selected>正常提报</option>
                                    <option value="1">使用库存</option>
<!--                                    <option value="3">暂不提报</option>-->
                                    <option value="0">无状态</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <div class="col-md-12">
                                <input type="text" class="form-control" name="remark" autocomplete="off" placeholder="备注">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-1">
                        <div class="form-group">
                            <div class="col-md-12">
                                <button type="button" class="btn btn-danger btn-append-del">删除</button>
                            </div>
                        </div>
                    </div>
                </div>
                `
            );
            $("#splitForm input[name=desc]").val($("#splitForm span[id=rppMatDesc]").text());
        });
        /** 追加表单删除 */
        $('#splitForm').on('click', '.btn-append-del', function () {
            $(this).parents(".row:first").remove();
        });
        /** 拆分提报计划 */
        $("#btn-split").click(function () {
            if (!validNum()) {
                js.modal.confirm("拆分数量与原数量不符，是否继续？", () => split());
            } else {
                split();
            }
        });
        /** 拆分模态框隐藏事件 */
        js.modal.hideEvent("modal-split", function () {
            js.reset("splitForm");
            $("#div-append").empty();
        });
        /** 报报计划拆分关系表 */
        mapTable = js.table.init({
            id: "map-table",
            showColumns: false,
            queryForm: 'mapForm',
            showExport: false,
            url: ctx + "buy/editReportPlan/map",
            firstLoad: false,
            toolbar: '',
            rowStyle: function (row) {
                if (row.rppSplitPlanType === 'oldSource') {
                    return {
                        classes: 'danger'
                    };
                } else if (row.rppSplitPlanType === 'old') {
                    return {
                        classes: 'warning'
                    };
                } else {
                    return {};
                }
            },
            columns: [
                {
                    title: '序号', field: 'id', width: '40',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: "计划员", field: 'rppPlanner'},
                {title: "物料描述", field: 'rppMatDesc'},
                {title: "数量", field: 'rppNum'},
                {title: "单位", field: 'rppUnit'},
                // { title: "标准号", field: 'rppStandardNo'},
                // { title: "分类", field: 'rppTypes'},
                // { title: "品牌", field: 'rppBrand'},
                // { title: "备注", field: 'rppRemark'},
                {title: "项目编号", field: 'rppProjectCode'},
                {title: "项目名称", field: 'rppProjectName'},
                {
                    title: "提报状态", field: 'rppUseStock',
                    formatter: function (value, row, index) {
                        if (value) {
                            return reportState[value];
                        }
                    }
                },
                // { title: "计划号", field: 'rppTypeId'},
                // { title: "提报日期", field: 'rppCreateTime', width: '90px'},
                {
                    title: "拆分类别", field: 'rppSplitPlanType',
                    formatter: function (value, row, index) {
                        if (value === 'oldSource') {
                            return "原计划";
                        } else if (value === 'old') {
                            return "旧计划";
                        } else if (value === 'new') {
                            return "新计划";
                        }
                    }
                },
                {
                    title: "操作",
                    width: '100px',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (sessionUser.name == row.rppPlanner || sessionUser.name == '管理员') {
                            if (row.rppOriginalFlag !== 3 && row.rppStatus === 2) {
                                // 未标记的可以修改
                                if (row.rppIsFlag === 0 && hasP("buy:planedit:edit")) {
                                    actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="openEditReportPlanModal(' + row.rppId + ',' + row.rppOriginalFlag + ')"> 修改</a> ');
                                }
                            }
                        }

                        return actions.join('');
                    }
                }
            ]
        });
        /** 提报计划拆分关系表搜索 */
        $("#btn-map-search").click(function () {
            js.table.search(mapTable);
        });


        /** changeReportPlanForm 表单验证规则 */
        js.validate.init("changeReportPlanForm", {
            fields: {
                rppPlanner: {validators: {notEmpty: {message: '请输入计划员'}}},
                rppMatDesc: {validators: {notEmpty: {message: '请输入物料描述'}}},
                rppProjectName: {validators: {notEmpty: {message: '请输入项目名称'}}}
            }
        });
        /** 变更提报计划 */
        $("#btn-change-report-plan").click(function () {
            // 非原材料类型，有余量没有实用数量的给出提示
            // let typeName = $("#changeReportPlanForm select[name=rppTypeId]").find("option:selected").text();
            // let overNum = $("#changeReportPlanForm input[name=rppOverNum]").val();
            // let realNum = $("#changeReportPlanForm input[name=rppRealNum]").val();
            // if (typeName != '原材料' && overNum && !realNum) {
            //     js.modal.alert("请添写实用数量");
            //     return;
            // }
            js.validSubmit({
                formId: "changeReportPlanForm",
                url: ctx + "buy/editReportPlan/change",
                data: new FormData($("#changeReportPlanForm")[0]),
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table);
                        if (mapTable) {
                            js.table.refresh(mapTable);
                        }
                        js.modal.hide("modal-change");
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        });
        /** 变更提报计划模态框隐藏事件 */
        js.modal.hideEvent("modal-change", function () {
            js.validate.reset("changeReportPlanForm");
            js.reset("changeReportPlanForm");
        });


        /** 指定库存表 */
        markTable = js.table.init({
            id: "mark-table",
            toolbar: '',
            showColumns: false,
            queryForm: 'markForm',
            pagination: false,
            url: ctx + "buy/editReportPlan/mark/list",
            firstLoad: false,
            showExport: false,
            columns: [
                {
                    checkbox: true,
                    formatter: function (value, row, index) {
                        if ($("#markForm input[name=info]").val()) {
                            return {checked: true}
                        } else {
                            return {disabled: false}
                        }
                    }
                },
                {title: "物料描述", field: 'info'},
                {title: "数量", field: 'num'},
                {title: "型号/标准号", field: 'standardNo'},
                {title: "项目编号", field: 'code'},
                {title: "项目名称", field: 'name'},
                {title: "调整类型", field: 'c'},
                {title: "库房类型", field: 'st'}
            ]
        });
        /** 指定库存表搜索 */
        $("#btn-mark-search").click(function () {
            js.table.search(markTable);
        });
        /** 提报计划指定库存 */
        $("#btn-mark").click(function () {
            // js.table.search(markTable);
            var arr = js.table.selectColumns(markTable, "id");
            //当不选择串料和库存划项目结果和不输入指定物料物料的时候清空指定状态到未指定
            if (arr.length < 1 && $("#markForm [name='rppAssignDesc']").val().trim().length == 0) {
                js.modal.confirm("您确认要清空指定信息吗？", function () {
                    $.post(ctx + 'buy/editReportPlan/clearAssign',
                        {
                            rppId: $("#markForm input[name=rppId]").val()
                        },
                        function (result) {
                            if (result.type == web_status.SUCCESS) {
                                js.modal.hide('modal-mark');
                                js.table.refresh(table);
                                js.modal.success(result.msg);
                            } else {
                                js.modal.fail(result.msg);
                            }
                        },
                        'json'
                    )
                })
            } else if (arr.length == 0 && $("#markForm [name='rppAssignDesc']").val().trim().length > 0) {
                $.post(ctx + 'buy/editReportPlan/clearRppId',
                    {
                        rppId: $("#markForm input[name=rppId]").val()
                    },
                    function (result) {
                        if (result.type == web_status.SUCCESS) {
                            js.modal.hide('modal-mark');
                            js.table.refresh(table);
                            js.modal.success(result.msg);
                        } else {
                            js.modal.fail(result.msg);
                        }
                    },
                    'json'
                )
            } else if (arr.length > 0) {
                var srcNum = +$("#markForm span[id=rppNum]").text();
                let a = js.table.selectColumns(markTable, "num");
                let b = a.map(v => +v);
                let c = b.reduce((x, y) => x + y);
                if (srcNum !== c) {
                    js.modal.confirm("指定数量与使用数量不符，是否继续？", () => {
                        mark();
                    });
                } else {
                    mark();
                }
            }
        });
        /** 提报计划指定物料名称 */
        $("#btn-assign").click(function () {
            if (!$("#markForm input[name=rppAssignDesc]").val().trim()) {
                js.modal.alert("请输入物料描述");
                return;
            }
            if (!$("#markForm input[name=rppAssignUseStockPrice]").val().trim()) {
                js.modal.alert("请输入单价");
                return;
            }

            if (!$("#markForm input[name=rppDiyAssignUseStockNum]").val().trim()) {
                js.modal.alert("请输入数量");
                return;
            }

            if (!$("#markForm input[name=rppDiyAssignUseStockUnit]").val().trim()) {
                js.modal.alert("请输入单位");
                return;
            }
            js.post({
                url: ctx + "buy/editReportPlan/assign",
                data: {
                    rppId: $("#markForm input[name=rppId]").val(),
                    rppAssignDesc: $("#markForm input[name=rppAssignDesc]").val(),
                    rppAssignUseStockPrice: $("#markForm input[name=rppAssignUseStockPrice]").val(),
                    rppDiyAssignUseStockNum: $("#markForm input[name=rppDiyAssignUseStockNum]").val(),
                    rppDiyAssignUseStockUnit: $("#markForm input[name=rppDiyAssignUseStockUnit]").val()
                },
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.modal.hide("modal-mark")
                        js.table.refresh(table);
                    } else {
                        js.modal.warning(result.msg);
                    }
                }
            });
        });
        /** 指定库存框态框隐藏清除搜索条件 */
        js.modal.hideEvent("modal-mark", function () {
            js.reset("markForm");
        });
        /** 原计划 */
        reportPlanTable = js.table.init({
            id: "report-plan-table",
            url: false,
            pagination: false,
            showColumns: false,
            showExport: false,
            sidePagination: null,
            toolbar: null,
            columns: [
                {title: "计划员", field: 'rppPlanner'},
                {title: "物料描述", field: 'rppMatDesc'},
                {title: "数量", field: 'rppNum'},
                // { title: "实用", field: 'rppRealNum'},
                // { title: "余量", field: 'rppOverNum'},
                {title: "单位", field: 'rppUnit'},
                {title: "型号/标准号", field: 'rppStandardNo'},
                {title: "分类", field: 'rppTypes'},
                {title: "品牌", field: 'rppBrand'},
                {title: "备注", field: 'rppRemark'},
                {title: "项目编号", field: 'rppProjectCode'},
                {title: "项目名称", field: 'rppProjectName'},
                {
                    title: "提报状态", field: 'rppUseStock',
                    formatter: function (value, row, index) {
                        if (value) {
                            return '<span class="badge ' + reportColors[value] + '">' + reportState[value] + '</span> ';
                        }
                    }
                },
                {
                    title: "生产状态", field: 'rppProjectState',
                    formatter: function (value, row, index) {
                        if (value) {
                            return '<span class="badge ' + projectColors[value] + '">' + projectState[value] + '</span> ';
                        }
                    }
                },
                {title: "计划号", field: 'rppPlanNo'},
                {title: "提报日期", field: 'rppCreateTime', width: '90px'},
                {title: "指定物料", field: 'rppAssignDesc'},
            ]
        });
        /** 指定信息 */
        markInfoTable = js.table.init({
            id: "mark-info-table",
            showExport: false,
            showColumns: false,
            toolbar: null,
            firstLoad: false,
            columns: [
                {title: "物料描述", field: 'info'},
                {title: "数量", field: 'num'},
                {title: "单位", field: 'unit'},
                {title: "项目编号", field: 'code'},
                {title: "项目名称", field: 'name'},
                {title: "调整类型", field: 'c'},
                {title: "库房类型", field: 'st'}
            ]
        });


        /** 初始化搜索条件 */
        $("#batchForm input[name=rppPlanner]").val(sessionUser.name);
        // $("#batchForm input[name=rppStatus]").val(2);
        // $("#batchForm input[name=rppIsFlag]").val(0);

        js.table.refresh(table);
        /** 批量修改提报状态表搜索 */
        $("#btn-batch-search").click(function () {
            js.table.search(batchTable);
        });

        /** 导出 */
        $("#a-export").click(function () {
            let actionUrl = $("#queryForm").attr("action");
            $("#queryForm").attr("action", ctx + "buy/editReportPlan/deferralExport");
            $("#queryForm").submit();
            js.modal.loading("正在导出，请稍候");
            setTimeout(function () {
                js.modal.closeLoading();
            }, 5000);

            $("#queryForm").attr("action", actionUrl);
        });

        /** 指定导出 */
        $("#a-assign-export").click(function () {
            let actionUrl = $("#queryForm").attr("action");
            $("#queryForm").attr("action", ctx + "buy/editReportPlan/assignDeferralExport");
            $("#queryForm").submit();
            js.modal.loading("正在导出，请稍候");
            setTimeout(function () {
                js.modal.closeLoading();
            }, 5000);

            $("#queryForm").attr("action", actionUrl);
        });


        /** 外购件批量指定表格 */
        outAssignTable = js.table.init({
            id: "out-assign-table",
            toolbar: '#out-assign-bar',
            showColumns: false,
            queryForm: 'outAssignForm',
            url: ctx + "buy/editReportPlan/list/outAssign",
            firstLoad: false,
            showExport: false,
            columns: [
                {
                    checkbox: true,
                    width: '30px'
                },
                {
                    title: '序号', field: 'id', width: '50px',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                // { title: "计划员", field: 'rppPlanner'},
                {title: "提报项目编号", field: 'rppProjectCode'},
                {title: "提报项目名称", field: 'rppProjectName'},
                {
                    title: "物料描述", field: 'rppMatDesc',
                    formatter: function (value, row, index, field) {
                        if (value && value.length > 50) {
                            return '<span title="' + value + '">' + value.substring(0, 50) + '</span> ';
                        } else {
                            return value;
                        }
                    }
                },
                {title: "数量", field: 'rppNum'},
                // { title: "单位", field: 'rppUnit'},
                {title: "型号/标准号", field: 'rppStandardNo'},
                // { title: "分类", field: 'rppTypes'},
                {title: "品牌", field: 'rppBrand'},
                {title: "备注", field: 'rppRemark', width: '60px'},

                // { title: "计划号", field: 'rppPlanNo'},
                // { title: "提报日期", field: 'rppCreateTime', width: '90px'},
                {title: "指定项目编号", field: 'code', width: '80px'},
                {title: "指定项目名称", field: 'name', width: '120px'},
                {title: "指定物料描述", field: 'info', width: '120px'},
                {title: "指定数量", field: 'num', width: '60px'},
                {title: "指定型号/标准号", field: 'standardNo', width: '90px'},
                {
                    title: "操作",
                    width: '60px',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (hasP('buy:planedit:assign')) {
                            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="outAssign(' + row.rppId + ')"> 指定</a> ');
                        }
                        return actions.join('');
                    }
                }
            ]
        });


        /** 指定采购计划表格 */
        assignPlanTable = js.table.init({
            id: "assign-plan-table",
            toolbar: null,
            showExport: false,
            showColumns: false,
            paginationVAlign: 'top',
            queryForm: 'assignPlanForm',
            url: ctx + "buy/editReportPlan/list/buy",
            pageSize: 10,
            firstLoad: false,
            columns: [
                {
                    title: '序号', field: 'id', width: '50px',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: "SAP<br>物料编号", field: 'sppSapCode'},
                {title: "采购<br>物料描述", field: 'sppMatDesc'},
                {title: "提报<br>数量", field: 'num'},
                {title: "采购<br>数量", field: 'sppNum'},
                {title: "品牌", field: 'sppBrand'},
                {title: "备注<br>计划用途", field: 'sppProjectName', width: '180px'}, // （相当于采购计划备注，导入OA时用，有字数限制，不超过40字）
                {title: "计划<br>采购日期", field: 'sppPlanDate', width: '90px'},
                {
                    title: "操作",
                    width: '60px',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (hasP('buy:planedit:assign')) {
                            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="assignPlanApply(' + row.sppId + ')"> 指定</a> ');
                        }
                        return actions.join('');
                    }
                }
            ]
        });
        /** 指定计划表格搜索 */
        $("#btn-assign-plan-search").click(function () {
            js.table.search(assignPlanTable);
        });
    });

    /**
     * 查看
     * */
    function look(id, recMark) {
        js.post({
            url: ctx + "buy/getReportPlanList/lookFile",
            data: {
                id: id,
                recMark: recMark
            },
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    let fileExtensions = result.data.substring(result.data.lastIndexOf(".") + 1);
                    if (fileExtensions.toUpperCase() === 'PDF') {
                        window.open([[@{/js/pdf/web/viewer.html}]]+'?file=' + result.data, 'PDF');
                    } else {
                        let isOPen = false;
                        for (let i = 0; i < imageFileType.length; i++) {
                            fileExtensions = fileExtensions.toUpperCase();
                            if (fileExtensions == imageFileType[i]) {
                                isOPen = true;
                                window.open(result.data);
                                break;
                            }
                        }
                        if (isOPen === false) {
                            js.modal.warning("该文件格式是：" + fileExtensions + "文件无法预览!");
                        }
                    }
                } else {
                    js.modal.warning("文件损坏！");
                }
            }
        })
    }

</script>
</body>
</html>